<template>
  <div class="wrap">
    <div class="header" style="display: block">
      <select-platform v-model="queryParams.platformType" @change="changePlatform" :num-arr="platformNum" :platform-type="queryParams.platformType" :disdisabled="loading" :show-packet="true"></select-platform>

      <div class="search-item">
        <user-order-check-box
          ref="userAccount"
          v-model="queryParams.userIds"
          :params="queryParams"
          :disdisabled="loading"
          @change="changeOption();getOrderGoods();getCutOffSetting();changeTimeString();getPacketCarrierNums();"
          :filterStop="true"></user-order-check-box>
      </div>


      <div class="search-item">
        <el-radio-group v-model="queryParams.tabType" size="small" @change="changeTab();changeOption();getAccountNum();getOrderGoods();getCutOffSetting();changeTimeString();getPacketCarrierNums();" class="mgr10" :disabled="loading">
          <el-radio-button style="margin-bottom: 3px" :label="1">{{$t('order.untreated')}}({{attrNumber(orderNum.untreatedNum)}})</el-radio-button>
          <el-radio-button style="margin-bottom: 3px" :label="8">{{$t('order.waitPicked')}}({{attrNumber(orderNum.waitPickNum)}})</el-radio-button>
          <el-radio-button style="margin-bottom: 3px" :label="2">{{$t('order.shipped')}}({{attrNumber(orderNum.sendNum)}})</el-radio-button>
          <el-radio-button v-show="!isPacket" style="margin-bottom: 3px" :label="9">{{ $t('order.collectedItems') }}({{attrNumber(orderNum.pickedNum)}})</el-radio-button>
          <el-radio-button v-show="!isPacket" style="margin-bottom: 3px" :label="10">{{ $t('order.inTransit') }}({{attrNumber(orderNum.inTransitNum)}})</el-radio-button>
          <el-radio-button v-show="!isPacket" style="margin-bottom: 3px" :label="3">{{$t('order.completed')}}({{attrNumber(orderNum.finishNum)}})</el-radio-button>
          <el-radio-button style="margin-bottom: 3px" :label="4">
            {{$t('order.canceled')}}({{attrNumber(orderNum.cancelNum)}})
          </el-radio-button>
          <el-radio-button v-show="!isPacket" style="margin-bottom: 3px" :label="5">
            {{$t('order.returned')}}({{attrNumber(orderNum.returnNum)}})
          </el-radio-button>
          <el-radio-button v-show="!isPacket" style="margin-bottom: 3px" :label="12">
            {{$t('order.rejected')}}({{attrNumber(orderNum.rejectedNum)}})
          </el-radio-button>
          <el-radio-button v-show="!isPacket" style="margin-bottom: 3px" :label="13">
            {{$t('order.lose')}}({{attrNumber(orderNum.loseNum)}})
          </el-radio-button>
          <el-radio-button v-show="!isPacket" style="margin-bottom: 3px" :label="6">{{$t('order.ignored')}}({{attrNumber(orderNum.ignoreNum)}})</el-radio-button>
          <el-radio-button v-show="!isPacket" style="margin-bottom: 3px" :label="11">{{$t('特殊')}}({{attrNumber(orderNum.specialNum)}})</el-radio-button>
          <el-radio-button style="margin-bottom: 3px" :label="7">{{$t('order.allOrders')}}({{attrNumber(orderNum.totalNum)}})</el-radio-button>
        </el-radio-group>
      </div>
      <div class="search-box">
        <div class="left">


        </div>
      </div>
      <div class="search-item">
        <div class="search-box">
          <div class="left">
            <el-radio-group v-model="queryParams.goodsType" class="mgr20" @change="changeOption();getOrderGoods();getAccountNum();getCutOffSetting();changeTimeString();getPacketCarrierNums();" :disabled="loading">
              <el-radio-button style="margin-bottom: 3px" label="">{{$t('order.allListingNum')}}</el-radio-button>
              <el-radio-button style="margin-bottom: 3px" :label="1">{{$t('order.singleListing')}}</el-radio-button>
              <el-radio-button style="margin-bottom: 3px" :label="2">{{$t('order.multipleListing')}}</el-radio-button>
            </el-radio-group>

            <el-radio-group v-model="queryParams.isCombinationGoods" v-if="!isPacket" class="mgr20" @change="changeOption();getOrderGoods();getAccountNum();getCutOffSetting();changeTimeString();getPacketCarrierNums();" :disabled="loading">
              <el-radio-button style="margin-bottom: 3px" label="">全部商品类型</el-radio-button>
              <el-radio-button style="margin-bottom: 3px" :label="1">单商品</el-radio-button>
              <el-radio-button style="margin-bottom: 3px" :label="2">组合商品</el-radio-button>
            </el-radio-group>

            <el-radio-group  v-model="queryParams.printType" size="small" class="mgr20" @change="changeOption();getOrderGoods();getAccountNum();getCutOffSetting();changeTimeString();" v-if="queryParams.tabType === 1 && !isPacket" :disabled="loading">
              <el-radio-button style="margin-bottom: 3px" label="">{{$t('order.allOrder')}}</el-radio-button>
              <el-radio-button style="margin-bottom: 3px" :label="1">{{$t('order.printable')}}</el-radio-button>
              <el-radio-button style="margin-bottom: 3px" :label="2">{{$t('order.Not printable')}}</el-radio-button>
            </el-radio-group>

            <el-radio-group v-model="queryParams.serveType" class="mgr20" v-if="queryParams.tabType !== 1 && queryParams.tabType !== 8" @change="changeOption();getOrderGoods();getAccountNum();" :disabled="loading">
              <el-radio-button style="margin-bottom: 3px" label="">{{$t('order.allPackagingServices')}}</el-radio-button>
              <el-radio-button style="margin-bottom: 3px" :label="1">{{$t('order.packaged')}}</el-radio-button>
              <el-radio-button style="margin-bottom: 3px" :label="2">{{$t('order.unpackaged')}}</el-radio-button>
            </el-radio-group>

            <el-radio-group v-model="queryParams.shippingType" v-if="queryParams.platformType === 7" @change="changeOption();getOrderGoods();getAccountNum();">
              <el-radio-button style="margin-bottom: 3px" label="">全部({{shippingTypeNum.total}})</el-radio-button>
              <el-radio-button style="margin-bottom: 3px" :label="1">平台面单({{shippingTypeNum.type1}})</el-radio-button>
              <el-radio-button style="margin-bottom: 3px" :label="0">物流面单({{shippingTypeNum.type0}})</el-radio-button>
            </el-radio-group>

          </div>
          <div class="right">

          </div>

        </div>
      </div>

      <div class="search-item" style="background-color: #FAFAFA; border-radius: 2%" v-if="queryParams.tabType === 1 && queryParams.platformType === 1 && !isPacket">
        <div class="search-box" v-if="false">
          <div class="left mgt10 mgl20">
            <div style="display: inline-block; width: 180px;">{{$t('order.Order time')}}：</div>
            <el-radio-group  v-model="timeType" size="small" class="mgr20 time-radio-group" @change="switchTimeModel('timeType');changeTimeType();getOrderGoods();getAccountNum();" v-if="queryParams.tabType === 1" :disabled="loading">
              <el-radio-button style="margin-bottom: 3px" label="" :disabled="untreatedOrderScreenTimeLoading">{{$t('common.all')}}（{{untreatedOrderScreenTimeDataBefore + untreatedOrderScreenTimeDataAfter}}）</el-radio-button>
              <el-radio-button style="margin-bottom: 3px" :label="1" :disabled="untreatedOrderScreenTimeLoading">{{$t('order.beforeTime',{time:untreatedOrderScreenTimeData})}}（{{untreatedOrderScreenTimeDataBefore}}）</el-radio-button>
              <el-radio-button style="margin-bottom: 3px" :label="2" :disabled="untreatedOrderScreenTimeLoading">{{$t('order.afterTime',{time:untreatedOrderScreenTimeData})}}（{{untreatedOrderScreenTimeDataAfter}}）</el-radio-button>
            </el-radio-group>
          </div>
        </div>
        <div class="search-box" v-if="queryParams.tabType === 1 && queryParams.platformType === 1">
          <div class="left mgl20 mgt10">
            <div style="display: inline-block; width: 180px; position: relative; top: -5px">
              {{$t('order.Post time')}}：
            </div>
            <el-radio-group v-model="queryParams.cutOffInfo" size="small" class="mgr20 mgb10 time-radio-group" @change="switchTimeModel('cutOffInfo');changeTimeType();getOrderGoods();getAccountNum();" v-if="queryParams.tabType === 1 && queryParams.platformType === 1" :disabled="loading">
              <el-radio-button style="margin-bottom: 3px" label="" :disabled="cutOffSettingAllLoading">{{$t('common.all')}}（{{cutOffSettingAllNum}}）</el-radio-button>
              <el-radio-button
                v-for="(item,index) in cutOffSetting"
                :key="index"
                style="margin-bottom: 3px"
                :label="item.maximumTime">
                <template v-if="item.maximumTime != 'tomorrow' && item.maximumTime != 'unknown'">
                  {{$t('common.Antes',{time:item.maximumTime})}}（{{item.num}}）
                </template>
                <template v-else-if="item.maximumTime === 'tomorrow'">
                  {{$t('common.tomorrowTwo')}}（{{item.num}}）
                </template>
                <template v-else>
                  {{$t('common.unknown')}}（{{item.num}}）
                </template>
              </el-radio-button>
            </el-radio-group>
            <el-tooltip class="item" effect="dark" placement="top">
              <template #content>{{$t('order.cutOff Info Tis One')}}<br/>{{$t('order.cutOff Info Tis Two')}}<br/>{{$t('order.cutOff Info Tis Three')}}</template>
              <i class="el-icon-question" style="color:#409eff; position: relative; top: -5px"></i>
            </el-tooltip>
            <el-button type="primary" @click="openAccountCutOffList" style="position: relative; top: -7px; left: 15px;">{{$t('order.cutOff.履约时间表')}}</el-button>
          </div>
        </div>
      </div>

      <div class="search-item" style="margin-top: -5px;margin-bottom: 25px">
        <el-date-picker
          class="mgb10 mgr20"
          v-model="queryParams.times"
          type="datetimerange"
          :start-placeholder="$t('order.orderStartDate')"
          :end-placeholder="$t('order.orderEndDate')"
          value-format="yyyy-MM-dd HH:mm:ss"
          @change="changeOption();changePicker();getAccountNum();getOrderGoods();getCutOffSetting();changeTimeString();getPacketCarrierNums();getOrderNum();"
        >
        </el-date-picker>
        <div style="display: inline-block;margin-right: 20px" class="mgb10 search-form-item">
          <el-input
            size="small"
            style="width: 320px; margin-right: 10px; margin-bottom: 3px"
            v-model.trim="queryParams.keyword"
            :placeholder="$t('order.searchForOrderID/Listing ID/SKU')"
            @keyup.enter.native="changeOption(true);getOrderGoods();getAccountNum();getCutOffSetting();changeTimeString();getPacketCarrierNums();getOrderNum();"
            clearable @clear="changeOption(false, 'clear');getOrderGoods();getAccountNum();getCutOffSetting();changeTimeString();getPacketCarrierNums();getOrderNum();"
          ></el-input>
          <el-button size="small" type="primary" @click="changeOption(true);getOrderGoods();getAccountNum();getCutOffSetting();changeTimeString();getPacketCarrierNums();getOrderNum();" class="search-button">{{$t('common.search')}}</el-button>
          <export-button :func="func" :query-params="queryParams" :exportType="'order_list'" :getTotal="total"></export-button>
        </div>

      </div>
      <div class="search-item" style="margin-top: -20px" v-show="queryParams.platformType === 1">
        <el-radio-group v-model="queryParams.logisticType" size="small" class="mgr10" @change="changeOption();getAccountNum();" :disabled="loading">
          <el-radio-button style="margin-bottom: 3px" label="">{{$t('common.all')}}({{attrNumber(logisticTypeNum.totalNum)}})</el-radio-button>
          <el-radio-button style="margin-bottom: 3px" label="other">{{ $t('order.convention') }}({{attrNumber(logisticTypeNum.otherNum)}})</el-radio-button>
          <el-radio-button style="margin-bottom: 3px" label="drop_off" :disabled="logisticTypeNum.dropOffNum === 0">{{ $t('order.express') }}({{attrNumber(logisticTypeNum.dropOffNum)}})</el-radio-button>
          <el-radio-button style="margin-bottom: 3px" label="custom">{{ $t('order.logisticsSheet') }}({{attrNumber(logisticTypeNum.customNum)}})</el-radio-button>
          <template v-if="queryParams.tabType === 1">
            <el-radio-button style="margin-bottom: 3px" label="self_service_1" :disabled="logisticTypeNum.selfService1Num === 0">Flex ({{$t('common.today')}})({{attrNumber(logisticTypeNum.selfService1Num)}})</el-radio-button>
            <el-radio-button style="margin-bottom: 3px" label="self_service_2" :disabled="logisticTypeNum.selfService2Num === 0">Flex ({{$t('common.tomorrow')}})({{attrNumber(logisticTypeNum.selfService2Num)}})</el-radio-button>

            <template v-if="this.$store.getters.siteId === 'CL'">
              <el-radio-button style="margin-bottom: 3px" label="cross_docking" :disabled="logisticTypeNum.crossDockingNum === 0">Colecta({{attrNumber(logisticTypeNum.crossDockingNum)}})</el-radio-button>
            </template>
            <template v-else>
              <el-radio-button style="margin-bottom: 3px" label="cross_docking_1" :disabled="logisticTypeNum.crossDocking1Num === 0">Colecta ({{$t('common.today')}})({{attrNumber(logisticTypeNum.crossDocking1Num)}})</el-radio-button>
              <el-radio-button style="margin-bottom: 3px" label="cross_docking_2" :disabled="logisticTypeNum.crossDocking2Num === 0">Colecta ({{$t('common.tomorrow')}})({{attrNumber(logisticTypeNum.crossDocking2Num)}})</el-radio-button>
            </template>

          </template>
          <template v-if="queryParams.tabType !== 1">
            <el-radio-button style="margin-bottom: 3px" label="self_service" :disabled="logisticTypeNum.selfServiceNum === 0">Flex({{attrNumber(logisticTypeNum.selfServiceNum)}})</el-radio-button>
            <el-radio-button style="margin-bottom: 3px" label="cross_docking" :disabled="logisticTypeNum.crossDockingNum === 0">Colecta({{attrNumber(logisticTypeNum.crossDockingNum)}})</el-radio-button>
          </template>

        </el-radio-group>
      </div>

      <div class="search-item" style="margin-top: -20px" v-show="queryParams.platformType === 4">
        <el-radio-group v-model="queryParams.logisticType" size="small" class="mgr10" @change="changeOption();getAccountNum();" :disabled="loading">
          <el-radio-button style="margin-bottom: 3px" label="">
            {{$t('common.all')}}({{attrNumber(logisticTypeNum.totalNum)}})
          </el-radio-button>
          <el-radio-button style="margin-bottom: 3px" label="deckSheet">
            {{ $t('order.deckSheet') }}({{attrNumber(logisticTypeNum.deckSheetNum)}})
          </el-radio-button>
          <el-radio-button style="margin-bottom: 3px" label="logisticsSheet">
            {{ $t('order.logisticsSheet') }}({{attrNumber(logisticTypeNum.logisticsSheetNum)}})
          </el-radio-button>
        </el-radio-group>
      </div>


      <div class="search-item" v-if="isPacket && queryParams.tabType === 2">
        <packet-carrier-opitons
            :packet-carrier="queryParams.packetCarrier"
            :packet-carrier-nums="packetCarrierNums"
            @change="queryParams.packetCarrier = $event;getData()"
        ></packet-carrier-opitons>
      </div>

      <div class="search-item">
        <el-row :gutter="20">
          <el-col :span="16">
            <el-card style="height: 100px" v-loading="orderGoodsItemLoading" :body-style="{padding: '10px 10px'}">
              <div
                style="overflow-x:auto;white-space: nowrap;"
              >
                <order-goods-num
                  v-for="goods in orderGoodsItem"
                  :key="goods.id"
                  :goods="goods"
                  :order-goods-item="queryParams.orderGoodsItem"
                  @click="chooseOrderGoodsItem"
                ></order-goods-num>

              </div>

            </el-card>
          </el-col>
          <el-col :span="8">
            <el-card style="padding-bottom: 10px;padding-top:15px;height: 100px">
              <span style="font-size: 14px">{{$t('order.sort')}}：</span>
              <el-radio-group v-model="queryParams.orderField" size="small" @change="changeOption" :disabled="loading">
                <el-radio-button label="created_date" @click.native.prevent="chooseOrderField('created_date')">{{$t('order.orderTime')}}<i :class="{
                  'el-icon-sort-down' : this.createdDateSort === 'desc',
                  'el-icon-sort-up': this.createdDateSort === 'asc',
                }"></i></el-radio-button>
                <el-radio-button label="amount" @click.native.prevent="chooseOrderField('amount')">{{$t('order.totalSales')}}<i :class="{
                  'el-icon-sort-down' : this.amountSort === 'desc',
                  'el-icon-sort-up': this.amountSort === 'asc',
                }"></i></el-radio-button>
              </el-radio-group>
            </el-card>
          </el-col>
        </el-row>
      </div>


    </div>
    <div class="content">
      <div class="order-item" v-loading="loading">
        <order-item
          v-for="order in data"
          :key="order.orderId"
          :order="order"
          :loading="loading"
          :select-order-id="selectOrderId"
          :query-params="queryParams"
          :integratedLogisticsSettingData="integratedLogisticsSettingData"
          :defaultLogisticsType="defaultLogisticsType"
          :subPackageMaterialArr="order.packageMaterialInfo.subPackageMaterialArr"
          :tagPackageMaterialName="order.packageMaterialInfo.tagPackageMaterialName"
          @changeSelectOrderId="selectOrder"
          @changeOrder="getAccountNum();getOrderGoods();getData();getOrderNum();removeSelectOrderId($event);getUserInfo();getCutOffSetting();changeTimeString();"
        ></order-item>

        <el-empty  v-if="data.length === 0"></el-empty>
      </div>

      <div class="page-wrap">
        <div class="left">
          <el-checkbox style="margin-right: 20px" v-model="checkAllFlag" @change="checkAll">{{$t('common.selectAll')}}</el-checkbox>

          <template v-if="[1,2].indexOf(queryParams.tabType) !== -1">
            <div style="display: inline-block" class="mgr10">
              <span style="font-size: 14px">{{$t('order.bulkOperation')}}：</span>
              <span style="font-size: 14px"><span class="font-red">{{selectOrderId.length}} </span>{{$t('order.itemSelected')}}</span>
            </div>
            <ignore-order
              :order-ids="selectOrderId"
              :account-type-num="queryParams.platformType"
              :type="2"
              v-if="queryParams.tabType === 1 && !isPacket"
              @changeOrder="getAccountNum();getOrderGoods();getData();getOrderNum();removeSelectOrderId($event);getUserInfo();getCutOffSetting();changeTimeString();"
            ></ignore-order>

            <el-button v-if="queryParams.tabType === 1 && false" type="primary" @click="batchPrintShipping" :loading="printLoading" :disabled="checkBatchPDFBtn">打印选中面单</el-button>

            <template v-if="queryParams.tabType === 1 && !isPacket">
              <el-button
                v-if="(queryParams.platformType === 1 && queryParams.logisticType !== 'custom') || (queryParams.platformType === 4 && queryParams.logisticType !== 'logisticsSheet') || (queryParams.platformType !== 1 && queryParams.platformType !== 4 && queryParams.platformType !== 7)"
                type="primary"
                :loading="printLoading"
                :disabled="checkBatchPDFBtn"
                @click="batchOrderCreatePicking"
              >
                {{$t('order.generatePickingList')}}
              </el-button>
              <LogisticsBatchOrderCreatePickingButton
                :accountTypeNum="queryParams.platformType"
                :logisticType="queryParams.logisticType"
                :integratedLogisticsSettingData="integratedLogisticsSettingData"
                :defaultLogisticsType="defaultLogisticsType"
                :selectOrderId="selectOrderId"
                style="display: inline"
              ></LogisticsBatchOrderCreatePickingButton>
            </template>


            <!--生成拣货单-->
            <template v-if="queryParams.platformType === 7">
              <template v-if="queryParams.tabType === 1">
                <packet-generate-picking-btn1 :select-order-ids="selectOrders" :shipping-type="1" @createPicking="createPickingFinish"></packet-generate-picking-btn1>
                <packet-generate-picking-btn1 :select-order-ids="selectOrders" :shipping-type="0" @createPicking="createPickingFinish"></packet-generate-picking-btn1>
              </template>
            </template>

            <el-button v-if="queryParams.tabType === 2" type="primary" plain @click="batchDownLoadingShipping" :loading="printLoading" :disabled="checkBatchDownPDFBtn">{{$t('order.downloadSelectedShipping')}}</el-button>
          </template>

        </div>
        <div class="right">
          <el-pagination
            background
            layout="total ,sizes , prev, pager, next, jumper"
            :current-page.sync="queryParams.page"
            :page-size="queryParams.pageSize"
            :total="total"
            :page-sizes="[20, 50, 100]"
            @current-change="getData"
            @size-change="handleSizeChange"
          >
          </el-pagination>
        </div>

      </div>
    </div>

    <el-dialog
      width="70%"
      :title="$t('order.cutOff.履约时间表') + ' (' + $t('order.cutOff.更新时间') + '：' + accountCutOffSaveDate + ')'"
      :visible.sync="accountCutOffListDialog"
    >
      <div class="content" style="margin-top: -30px;">
        <el-table
          v-loading="accountCutOffLoading"
          :data="accountCutOffListData"
          border
        >
          <el-table-column
            prop="userName"
            :label="$t('order.cutOff.用户名')"
            align="center"
            min-width="100"
          >
          </el-table-column>
          <el-table-column
            prop="nickname"
            :label="$t('order.cutOff.店铺')"
            align="center"
            min-width="100"
          >
          </el-table-column>
          <el-table-column
            prop="cutoff"
            :label="$t('order.cutOff.截单时间')"
            align="center"
            min-width="100"
          >
          </el-table-column>
          <el-table-column
            prop="maximumTime"
            :label="$t('order.cutOff.送达时间')"
            align="center"
            min-width="100"
          >
          </el-table-column>
          <el-table-column
            prop="processingTime"
            :label="$t('order.cutOff.履约时间')"
            align="center"
            min-width="100"
          >
          </el-table-column>
        </el-table>
      </div>
    </el-dialog>

  </div>
</template>

<script>
import {attrNumber, getCountryIcon, getTargetDate} from "@/utils/common";
import {
  createPicking,
  downLoadShipping,
  getCutOffSetting,
  getFaOrderList,
  getOrderGoodsNum,
  getOrderList,
  getOrderListNum,
  getOrderPlatformNum,
  getSiOrderList,
  getUntreatedOrderScreenTime,
  printShipping,
  getAmazonOrderList,
  getTikTokOrderList,
  getAccountCutOffListData,
  getPacketOrderList,
  getPacketCarrierNums,
  getAliexpressOrderList,
} from "@/api/order";

import ExportButton from "@/views/order/components/ExportButton.vue";
import {deepCopy} from "@/utils";
import OrderGoodsNum from "@/views/order/components/OrderGoodsNum.vue";

import {getAllAccountList} from "@/api/business";
import UserAccountCheckBox from "@/views/order/components/UserAccountCheckBox.vue";
import OrderItem from "@/views/order/components/OrderItem.vue";
import UserAccountOrderCheckBox from "@/views/order/components/UserAccountOrderCheckBox.vue";
import {editAdminLogShow, getInfo, getIsShowLog, getUserInfo, getUserOptions} from "@/api/user";
import IgnoreOrder from "@/views/order/components/IgnoreOrder.vue";
import OrderTimesPicker from "@/views/order/components/OrderTimesPicker.vue";
import UserOrderCheckBox from "@/views/order/components/UserOrderCheckBox.vue";
import SelectPlatform from "@/components/SelectPlatform/index.vue";
import LogisticsBatchOrderCreatePickingButton from "@/views/order/components/LogisticsBatchOrderCreatePickingButton.vue";
import PacketCarrierOpitons from "@/views/order/components/PacketCarrierOpitons.vue";
import PacketPickupDateDialog from "@/views/order/components/PacketPickupDateDialog.vue";
import PacketGeneratePickingBtn1 from "@/views/order/components/PacketGeneratePickingBtn1.vue";
import request from "@/utils/request";
import {getUpToDateLog} from "@/api/helpDocument";
import {mapGetters} from "vuex";

export default {
  name: "orderList",
  components: {
    PacketGeneratePickingBtn1,
    PacketCarrierOpitons,
    SelectPlatform,
    UserOrderCheckBox,
    IgnoreOrder,
    ExportButton,
    OrderGoodsNum,
    OrderItem,
    LogisticsBatchOrderCreatePickingButton,
  },
  data(){
    return {
      getCountryIcon,
      loading: false,
      orderGoodsItemLoading: false,
      queryParams: {
        page: 1,
        pageSize: 20,
        tabType : 1, // 状态
        goodsType : '', //  商品类型
        skuType: '', // 库存类型
        orderField: 'created_date', // 排序
        goodsOrigin: '', // 商品来源
        orderStatus: '', // 订单状态
        keyword: '',
        orderGoodsItem:[], // 订单商品聚合搜索
        accountIds: [-1], // 店铺选择
        times: [],
        orderSort: 'desc',
        userIds: [-1],
        logisticType: '',
        estimatedType: '',
        platformType: this.$store.getters.defaultAccountTypeNum,
        serveType: '', // 服务类型
        printType: '',
        cutOffInfo: '',
        logisticMode: '',
        packetCarrier: '',
        shippingType: '',
        isCombinationGoods: '',
      },
      data:[],
      integratedLogisticsSettingData: [],
      defaultLogisticsType: '',
      total: 0,
      selectOrderId: [],
      selectOrders: [], // 选择的订单
      // 订单数量
      orderNum:{
        untreatedNum: 0, // 未处理
        sendNum: 0, // 已发货
        inTransitNum: 0, // 运输中
        finishNum: 0, // 已完成
        cancelNum: 0, // 已取消
        returnNum: 0, // 已退货
        rejectedNum: 0, // 已拒收
        loseNum: 0, // 丢失
        ignoreNum: 0, // 已忽略
        waitPickNum: 0, // 待拣货数量
        totalNum: 0, // 全部订单数量
        pickedNum: 0, // 已揽件
        specialNum: 0, // 特殊
      },
      logisticTypeNum: {
        totalNum: 0,
        otherNum: 0,
        dropOffNum: 0,
        selfServiceNum: 0,
        selfService1Num: 0,
        selfService2Num: 0,
        crossDockingNum: 0,
        crossDocking1Num: 0,
        crossDocking2Num: 0,
        customNum: 0,
      },
      checkAllFlag: false,
      orderGoodsItem:[], //
      checkAllCountry: true,
      attrNumber,
      checkAllAccount: true, // 是否选择了所有店铺
      accountOptions:[], // 店铺的选项
      isAccountExpend: true, // 是否展示所有店铺
      accountLine: 0,
      printLoading: false,
      createdDateSort: 'desc',
      amountSort: 'desc',
      timeType: '',
      timeString: [
        '今天10:00前','今天10:00后'
      ],
      untreatedOrderScreenTimeData: '10:00',
      untreatedOrderScreenTimeDataBefore: 0,
      untreatedOrderScreenTimeDataAfter: 0,
      siteId: 'MX',
      platformNum: [],
      is_search: false,
      untreatedOrderScreenTimeLoading: false,
      cutOffSettingAllLoading: false,
      cutOffSetting: [],
      cutOffSettingAllNum: 0,
      accountCutOffListDialog: false,
      accountCutOffLoading: false,
      accountCutOffListData: [],
      accountCutOffSaveDate: '',
      func: getOrderList,
      packetCarrierNums: null,
      shippingTypeNum: {
        total: 0,
        type0: 0,
        type1: 0,
      },

    }
  },
  created() {
    // this.setQueryParams()
    const pageSize = localStorage.getItem('orderListPageSize')
    if(pageSize){
      this.queryParams.pageSize = Number(pageSize)
    }
    this.changeTimeString()
    this.getOrderNum() // 获取订单各个状态数量
    this.getOrderGoods() // 获取聚合搜索
    this.getData() // 获取订单
    this.getOrderPlatformNum()
    this.getCutOffSetting()
  },
  computed:{
    tableData(){
      const tableDate = [];
      this.data.forEach(item=>{
        const obj = item;
        tableDate.push(obj)
      })
      return tableDate;
    },
    // 能够选择的站点
    canCheckCountry(){
      return this.countryOptions.filter(item => !item.disable);
    },
    // 判断全部站点的选择框是不是不定式
    isIndeterminate(){
      let flag = true;
      const canCheckCountry = this.canCheckCountry;
      if(canCheckCountry.length === this.queryParams.countries.length){
        flag = false
      }
      if(this.queryParams.countries.length === 0){
        flag = false
      }
      return flag
    },
    // 全部站点未处理的订单数量
    allCountryOrderNum(){
      let num = 0;
      this.countryOptions.forEach(item=>{
        num += item.num;
      })
      return num
    },
    // 店铺全选不定式
    isIndeterminateAccount(){
      let flag = true;
      if(this.queryParams.accountIds.length === 0){
        return false;
      }
      if(this.queryParams.accountIds.length === this.accountOptions.length){
        return false;
      }
      return flag;
    },
    // 全部店铺的订单数
    allAccountOrderNum(){
      let num = 0;
      this.accountOptions.forEach(item=>{
        num += item.orderNum;
      })
      return num;
    },
    // 判断批量打印按钮是否禁用
    checkBatchPDFBtn(){
      return !this.selectOrders.some(item=>{
        // if(this.queryParams.platformType === 6){
        //   return true;
        // }
        // console.log(this.queryParams.platformType)
        // console.log(item)
        if(this.queryParams.platformType === 1){
          if(item.shipping && (item.shipping.printShipping) || (item.shipping.logisticMode === 'custom' && item.shipping.status === 'pending')){
            return true;
          }
        }
        if(this.queryParams.platformType === 4){
          if(item.shipping && (item.shipping.printShipping) && item.performanceType === 1){
            return true;
          }
        }
        if(this.queryParams.platformType === 6){
          if(item.shipping && item.shipping.shippingId){
            return true;
          }
        }

      })
    },
    // 判断批量打印按钮是否禁用
    checkBatchDownPDFBtn(){
      return !this.selectOrders.some(item=>{
        return item.shipping && item.shipping.downShipping
      })
    },
    // 当前选择是否是小包
    isPacket() {
      return this.queryParams.platformType === 7;
    },
    ...mapGetters( [
      'id','isShowLog'
    ]),
  },
  mounted() {
    window.addEventListener('resize', this.onWindowResize);

  },
  methods:{

    getOrderList,
    changeTimeString(){
      this.siteId = this.$store.getters.siteId
      this.untreatedOrderScreenTimeLoading = true
      getUntreatedOrderScreenTime(this.queryParams)
        .then(res=>{
            if (res.info.untreatedOrderScreenTime) {
              this.untreatedOrderScreenTimeData = res.info.untreatedOrderScreenTime
              this.untreatedOrderScreenTimeDataBefore = res.info.timeOrderNum.before
              this.untreatedOrderScreenTimeDataAfter = res.info.timeOrderNum.after
            }
          this.untreatedOrderScreenTimeLoading = false
        })
    },
    onWindowResize() {
      if (this.$refs.accountIdsCheckBox) {
        this.$refs.accountIdsCheckBox.dispatchEvent(new Event('resize'));
      }
    },
    handleSizeChange(pageSize){
      this.queryParams.pageSize = pageSize
      localStorage.setItem('orderListPageSize',this.queryParams.pageSize)
      this.queryParams.page = 1
      this.getData()
    },
    // 获取表单数据
    getData(){
      this.loading = true
      this.checkAllFlag = false;
      this.func = getOrderList;
      if(this.queryParams.platformType === 2){
        this.func = getFaOrderList;
      } else if (this.queryParams.platformType === 4) {
        this.func = getSiOrderList;
      } else if (this.queryParams.platformType === 5) {
        this.func = getAmazonOrderList;
      } else if (this.queryParams.platformType === 6) {
        this.func = getTikTokOrderList;
      }else if (this.queryParams.platformType === 7) {
        this.func = getPacketOrderList;
      } else if (this.queryParams.platformType === 8) {
        this.func = getAliexpressOrderList;
      }
      const oldPlatformType = this.queryParams.platformType
      this.func(this.queryParams)
        .then(res=>{
          if (this.queryParams.platformType !== oldPlatformType) {
            return;
          }
          // const info = res.info
          res.data.forEach((row) => {
            row.packageMaterialInfo = this.getPackageMaterialArr(row)
          });
          this.data = res.data
          this.getPackageMaterialArr(res)
          // this.count = res.info.count
          this.loading = false;

          this.total = res.info.total

          // 物流类型的订单
          this.logisticTypeNum.otherNum = res.info.otherNum
          this.logisticTypeNum.dropOffNum = res.info.dropOffNum
          this.logisticTypeNum.customNum = res.info.customNum || 0
          this.logisticTypeNum.selfServiceNum = res.info.selfServiceNum
          this.logisticTypeNum.selfService1Num = res.info.selfService1Num
          this.logisticTypeNum.selfService2Num = res.info.selfService2Num
          this.logisticTypeNum.crossDockingNum = res.info.crossDockingNum
          this.logisticTypeNum.crossDocking1Num = res.info.crossDocking1Num
          this.logisticTypeNum.crossDocking2Num = res.info.crossDocking2Num
          this.logisticTypeNum.deckSheetNum = res.info.deckSheetNum || 0
          this.logisticTypeNum.logisticsSheetNum = res.info.logisticsSheetNum || 0

          this.integratedLogisticsSettingData = res.info.integratedLogisticsSettingData
          this.defaultLogisticsType = res.info.defaultLogisticsType

          this.logisticTypeNum.totalNum = this.logisticTypeNum.otherNum;
          this.logisticTypeNum.totalNum += this.logisticTypeNum.selfServiceNum;
          this.logisticTypeNum.totalNum += this.logisticTypeNum.crossDockingNum;
          this.logisticTypeNum.totalNum += this.logisticTypeNum.dropOffNum;
          this.logisticTypeNum.totalNum += this.logisticTypeNum.deckSheetNum;
          this.logisticTypeNum.totalNum += this.logisticTypeNum.logisticsSheetNum;
      })
    },
    getPackageMaterialArr(res){
      //计算包材显示数据
      this.packageMaterialArr = [];
      if (res.packageMaterialInfo !== undefined && res.packageMaterialInfo !== null && res.packageMaterialInfo.length > 0) {
        this.packageMaterialArr = res.packageMaterialInfo
      } else {
        if (Array.isArray(res.subOrders)) {
          res.subOrders.forEach((rowq, index) => {
            let numInfo = [];
            let selectPackageMaterialName = '';
            if ((res.acquiescePackageMaterialId > 0 && res.orderStatus === 1) || (res.acquiescePackageMaterialId > 0 && res.orderStatus === 6)) {
              if (rowq.packageMaterialData.name !== null) {
                selectPackageMaterialName = rowq.packageMaterialData.name
              }
            }
            for (let i = 0; i < rowq.num; i++) {

              let skuPackageMaterialInfo = {
                //用户设置包材id
                'acquiescePackageMaterialId' : rowq.packageMaterialData.package_material_id,
                'sku' : rowq.sku,
                'selectPackageMaterialId' : '',
                'selectPackageMaterialName' : selectPackageMaterialName,
                'number' : i + 1,
              }
              numInfo.push(skuPackageMaterialInfo)
            }

            let skuPackageMaterial = {
              'sku' : rowq.sku,
              'num' : rowq.num,
              'index' : index,
              'numInfo' : numInfo,
            }
            this.packageMaterialArr.push(skuPackageMaterial)
          })
        }
      }

      let StrArr = []
      let subPackageTag = []
      let tagPackageMaterialName = ''
      this.packageMaterialArr.forEach((row) => {
        if (Array.isArray(row.numInfo)) {
          let map = new Map();
          row.numInfo.forEach((rowItem) =>{
            if (map.has(rowItem.selectPackageMaterialName)) {
              map.set(rowItem.selectPackageMaterialName, map.get(rowItem.selectPackageMaterialName) + 1);
            } else {
              map.set(rowItem.selectPackageMaterialName, 1);
            }
            StrArr.push(rowItem.selectPackageMaterialName);
          })
          for (const [i, v] of map.entries()) {
            if (i !== '') {
              let subPackageTagItem = {}
              subPackageTagItem['sku'] = row.sku
              if (v > 1) {
                subPackageTagItem['tagTitle'] = i + 'x' + v
              } else {
                subPackageTagItem['tagTitle'] = i
              }
              tagPackageMaterialName = i
              subPackageTagItem['tagTitleInfo'] = i
              let index = res.packageMaterial.findIndex(obj => obj.name === i);
              subPackageTagItem['tagTitleInfoNum'] = index + 1
              subPackageTagItem['skuIndex'] = row.index
              subPackageTag.push(subPackageTagItem)
            }
          }
        }
      })

      return {
        'subPackageMaterialArr' : subPackageTag,
        'tagPackageMaterialName' : tagPackageMaterialName
      }
    },
    getOrderNum(){
      getOrderListNum(this.queryParams)
        .then(res=>{
          this.orderNum.untreatedNum = res.data.untreatedNum
          this.orderNum.sendNum = res.data.sendNum
          this.orderNum.inTransitNum = res.data.inTransitNum
          this.orderNum.finishNum = res.data.finishNum
          this.orderNum.cancelNum = res.data.cancelNum
          this.orderNum.returnNum = res.data.returnNum
          this.orderNum.rejectedNum = res.data.rejectedNum
          this.orderNum.loseNum = res.data.loseNum
          this.orderNum.ignoreNum = res.data.ignoreNum
          this.orderNum.totalNum = res.data.totalNum
          this.orderNum.waitPickNum = res.data.waitPickNum
          this.orderNum.pickedNum = res.data.pickedNum
          this.orderNum.specialNum = res.data.specialNum
        })
    },
    // 获取聚合模块
    getOrderGoods(){
      this.orderGoodsItem = [];
      this.orderGoodsItemLoading = true
      getOrderGoodsNum(this.queryParams)
        .then(res=>{
          this.orderGoodsItemLoading = false
          this.orderGoodsItem = deepCopy(res.data)
        })
    },
    // 触发变更事件
    changeOption(is_search = false, type = ''){
      if (is_search === true) {
        //判断是否使用过搜索按钮
        this.is_search = true
      }
      if (type === 'clear') {
        if (this.is_search === false) {
          return
        } else {
          this.is_search = false
        }
      }
      this.queryParams.page = 1
      this.selectOrderId = [];
      this.selectOrders = [];
      this.getData()
      this.getShippingTypeNum();
    },
    // 触发子组件事件
    getAccountNum(){
      this.$refs.userAccount.getAgain()
    },
    // 选择了聚合筛选
    chooseOrderGoodsItem(goods,flag){
      if(flag){ // 添加
        this.queryParams.orderGoodsItem.push({
          id: goods.id,
          goodsId: goods.goodsId,
          variationId: goods.variationId,
        })
      }else{ // 移除
        const index = this.queryParams.orderGoodsItem.findIndex(res => res.id === goods.id);
        this.queryParams.orderGoodsItem.splice(index,1);
      }
      this.page = 1;
      this.getData();
    },
    // 跳转到订单详情页
    jumpInfo(row){
      this.$router.push({
        name:'orderInfo',
      })
    },
    // 选择订单
    selectOrder(orderId,flag,order){
      // 选择订单
      if(flag){
        if(this.selectOrderId.indexOf(orderId) === -1){
          const index = this.selectOrderId.indexOf(orderId)
          this.selectOrderId.push(orderId)
        }
        if(this.selectOrders.findIndex(item => item.orderId === orderId) === -1){
          this.selectOrders.push(order)
        }

      }else{
        // 取消订单
        if(this.selectOrderId.indexOf(orderId) !== -1){
          const index = this.selectOrderId.indexOf(orderId)
          this.selectOrderId.splice(index,1)
        }
        const orderIndex = this.selectOrders.findIndex(item => item.orderId === orderId)
        if(orderIndex !== -1){
          this.selectOrders.splice(orderIndex,1);
        }

      }
      this.checkAllFlag = this.selectOrderId.length === this.data.length
    },
    // 监听子组件事件
    changeOrder(){
      this.getData()
      this.getOrderGoods()
      this.getOrderPlatformNum()
      this.getCutOffSetting()
      this.$store.dispatch('user/getInfo');
    },
    // 全选
    checkAll(){
      if(this.checkAllFlag){
        this.selectOrderId = [];
        this.selectOrders = [];
        this.data.forEach(item=>{
          if(!item.shipping){
            return false
          }
          if(item.isSpecial){
            return false;
          }
          // 只有待处理的才能选择
          if((item.orderStatus === 1 || item.orderStatus === 2) && item.ignore === 0 && item.amountType !== 3){
            // 卖家自己打印 isPrinted: true; downShipping: false; (不可生成)
            // 系统自动打印 isPrinted: true; downShipping: true; (可以生成)
            // 已打印了
            if (item.shipping.isPrinted && !item.shipping.downShipping) {
              return false
            }
            if (item.accountTypeNum === 1 && item.shipping.logisticMode === 'custom' && item.shipping.status === 'pending' && this.queryParams.logisticType !== 'custom') {
              return false
            }
            if (item.accountTypeNum === 4 && item.performanceType === 2 && this.queryParams.logisticType !== 'logisticsSheet') {
              return false
            }
            if (item.accountTypeNum === 6 && !item.shipping.shippingId) {
              return false
            }
            this.selectOrderId.push(item.orderId)
            this.selectOrders.push(item)
          }
        })
      }else{
        this.selectOrderId = [];
        this.selectOrders = [];
      }
    },
    // 选择店铺
    checkAccount(account,$event){
      if(this.checkAllAccount === true){
        this.queryParams.accountIds = [account.label];
        this.checkAllAccount = false
      }else{
        const index = this.queryParams.accountIds.indexOf(account.label)
        if(index === -1){
          this.queryParams.accountIds.push(account.label)
        }else{
          this.queryParams.accountIds.splice(index,1)
        }
      }

    },
    onContainerResize(){
      const select = this.$refs.accountIdsCheckBox;
      let offsetHeight = select.offsetHeight;
      this.accountLine = Math.ceil(offsetHeight / 29)
    },
    // 打印面单
    batchPrintShipping(){
      const postData = {
        orderIds: this.selectOrderId
      }
      this.printLoading = true;
      printShipping(postData)
        .then(res=>{
          this.printLoading = false;
          if(res.type === 'application/json'){
            this.$errorMessage('系统繁忙，请稍后再试');
            return;
          }
          this.$successMessage('已同时为您生成拣货需求表');
          this.printLoading = false;
          const pdfFile = window.URL.createObjectURL(
            new Blob([res.data], { type: "application/pdf" })
          );
          // 跳转页面预览
          window.open(pdfFile);
          // 60秒后释放
          setTimeout(()=>{
            URL.revokeObjectURL(pdfFile); //释放URL对象
          },60000)

          this.$router.go(0)
          this.$store.dispatch('user/getInfo');

        })
    },
    // 下载面单
    batchDownLoadingShipping(){
      const postData = {
        orderIds: this.selectOrderId,
        accountTypeNum: this.queryParams.platformType,
      }
      this.printLoading = true;
      downLoadShipping(postData)
        .then(res=>{
          this.printLoading = false;
          if(res.type === 'application/json'){
            this.$message({
              message: '面单下载失败，请通过美客多后台下载或者稍后再尝试',
              duration : 5000,
              type: 'error',
              showClose: true,
            });
            return;
          }
          this.printLoading = false;
          const pdfFile = window.URL.createObjectURL(
            new Blob([res.data], { type: "application/pdf" })
          );
          // 跳转页面预览
          window.open(pdfFile);
          // 60秒后释放
          setTimeout(()=>{
            URL.revokeObjectURL(pdfFile); //释放URL对象
          },60000)

        })
    },
    // 生成拣货单
    batchOrderCreatePicking(){
      const postData = {
        orderIds: this.selectOrderId,
        accountTypeNum: this.queryParams.platformType,
      }
      this.printLoading = true
      createPicking(postData)
        .then(res=>{
          this.printLoading = false
          if(res.error !== 0){
            this.$errorMessage(res.message)
          }else{
            const pickingNo = res.data.pickingNo
            let routeUrl = this.$router.resolve({
              name: 'packInfo',
              query: {
                'pickingNo' : pickingNo,
              }
            })
            // 新标签打开路由
            window.open(routeUrl.href, '_blank');
            // 刷新当前页面
            this.$router.go(0)
          }
        })
    },
    chooseOrderField(field){
      if(this.queryParams.orderField === field){
        switch (field){
          case 'created_date':
            this.createdDateSort = this.createdDateSort === 'asc' ? 'desc' : 'asc';
            break;
          case 'amount':
            this.amountSort = this.amountSort === 'asc' ? 'desc' : 'asc';
            break;
        }
      }else{
        this.queryParams.orderField = field
      }
      switch (field){
        case 'created_date':
          this.queryParams.orderSort = this.createdDateSort
          break;
        case 'amount':
          this.queryParams.orderSort = this.amountSort
          break;
      }
      this.changeOption()
    },
    removeSelectOrderId(orderId){
      const index = this.selectOrderId.indexOf(orderId)
      const orderIndex = this.selectOrders.findIndex(item => item.orderId === orderId)
      if(index !== -1){
        this.selectOrderId.splice(index,1)
      }
      if(orderIndex !== -1){
        this.selectOrders.splice(orderIndex,1)
      }
    },
    // 选择时间更改
    changeTimeType(){
      const date = getTargetDate();
      const startDate = getTargetDate();
      //获取年份
      let Y = date.getFullYear();
      //获取月份
      let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1);
      //获取当日日期
      let D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
      let todayDate = Y + '-' + M + '-' + D;
      this.queryParams.times = [];
      switch (this.timeType){
        case 0:
          this.queryParams.times[0] = '';
          this.queryParams.times[1] = '';
          break;
        case 1:
          startDate.setTime(date.getTime() - 3600 * 1000 * 24 * 15);
          this.queryParams.times[0] = this.formatDate(startDate) + ' 00:00:00';
          this.queryParams.times[1] = todayDate + ' ' + this.untreatedOrderScreenTimeData + ':00';
          break;
        case 2:
          this.queryParams.times[0] = todayDate + ' ' + this.untreatedOrderScreenTimeData + ':00';
          this.queryParams.times[1] = todayDate + ' 23:59:59';
          break;
      }
      this.changeOption()
    },
    changePicker(){
      this.timeType = '';
    },
    changeTab(){
      this.queryParams.times = [];
      this.queryParams.logisticType = ''
      this.timeType = ''
    },
    formatDate(date){
      let year = date.getFullYear()
      let month = date.getMonth() + 1
      month = month < 10 ? ('0' + month) : month
      let day = date.getDate()
      day = day < 10 ? ('0' + day) : day
      return `${year}-${month}-${day}`
    },
    // 改变时间筛选状态
    changeEstimatedType(){
      this.queryParams.page = 1;
      this.queryParams.times = [];
      this.queryParams.logisticType = ''
      this.timeType = '';
      this.getOrderGoods();
      this.getData()
    },
    changePlatform(){
      this.queryParams.page = 1;
      this.queryParams.keyword = '';
      this.queryParams.orderGoodsItem = [];
      this.queryParams.logisticType = '';
      this.queryParams.tabType = 1;
      this.selectOrderId = [];
      this.selectOrders = [];
      // this.queryParams.userIds = [-1];
      // this.$refs.userAccount.checkAll = true
      this.getOrderNum() // 获取订单各个状态数量
      this.getOrderGoods() // 获取聚合搜索
      this.getData() // 获取订单
      this.getAccountNum()
      this.changeTimeString();

      if (this.isPacket) {
        this.getPacketCarrierNums();
        this.getShippingTypeNum()
      }
    },
    getOrderPlatformNum(){
      getOrderPlatformNum({type:1})
        .then(res=>{
          this.platformNum = deepCopy(res.data)
        })
    },
    // 重新请求数量 改变侧边栏数字
    getUserInfo(){
      this.$store.dispatch('user/getInfo');
    },
    //获取物流调度设置
    getCutOffSetting(){
      this.cutOffSetting = []
      this.cutOffSettingAllNum = 0
      this.cutOffSettingAllLoading = true
      getCutOffSetting(this.queryParams)
        .then(res=>{
          let allNum = 0;
          Object.keys(res.data).forEach(function(key) {
            allNum += res.data[key].num
            if (res.data[key].num <= 0 && res.data[key].maximumTime !== 'tomorrow' && res.data[key].maximumTime !== 'unknown') {
              delete res.data[key];
            }
          });
          this.cutOffSetting = deepCopy(res.data)
          this.cutOffSettingAllNum = allNum
          this.cutOffSettingAllLoading = false
        })
    },
    switchTimeModel($model){
      if ($model === 'timeType') {
        this.queryParams.cutOffInfo = ''
      } else if ($model === 'cutOffInfo') {
        this.timeType = ''
      }
    },
    getPacketCarrierNums() {
      getPacketCarrierNums(this.queryParams)
        .then(res => {
          this.packetCarrierNums = res.data
        })
    },
    //打开物流调度列表
    openAccountCutOffList(){
      //跳转页面显示截单数据
      let routeUrl = this.$router.resolve({
        name: 'cutOffList',
      })
      // 新标签打开路由
      window.open(routeUrl.href, '_blank');
      // this.accountCutOffListDialog = true
      // this.getAccountCutOffListData()
    },
    //当前页面显示截单数据
    getAccountCutOffListData(){
      getAccountCutOffListData()
        .then(res=>{
          this.accountCutOffListData = res.data
          this.accountCutOffSaveDate = res.info.save_date
        })
    },
    createPickingFinish(){
      this.getData()
      this.selectOrderId = []
      this.selectOrders = []
    },
    // 获取shippingType的数量
    getShippingTypeNum(){
      if(this.queryParams.platformType !== 7){
        return;
      }
      request({
        url: '/order/getShippingTypeNum',
        params: this.queryParams
      })
        .then(res=>{
          this.shippingTypeNum = res.data
        })
    }
  },

}
</script>

<style>
.time-radio-group{
  .el-radio-button__inner{

  }
  .el-radio-button__inner:hover {
    color: #ff6d6d;
  }
  .el-radio-button__orig-radio:checked + .el-radio-button__inner {
    color: #FFFFFF;
    background-color: #ff6d6d;
    border-color: #ff6d6d;
    -webkit-box-shadow: -1px 0 0 0 #ff6d6d;
    box-shadow: -1px 0 0 0 #ff6d6d;
  }
}
</style>

<style scoped lang="less">
.wrap {
  padding: 30px 30px;
  .header{
    .search-item{
      margin-bottom: 15px;
      .search-box{
        display: flex;
        justify-content: space-between;
        .hidden-account-options {
          overflow: hidden;
          max-height: 29px;
        }
        .left{

        }
      }
    }
    .right{
      .search-form-item{
        position: relative;
        .search-button{
          position: absolute;
          right: 0;
        }
      }

    }
  }
  .page-wrap{
    display: flex;
    justify-content: space-between;
  }
  .content{
    padding: 20px 0 0;
  }
  .table-order{
    p{
      margin: 0;
      padding: 0;
    }
    font-size: 13px;
  }
}
.header{
  .el-radio-button__inner{
    padding: 8px 20px;
  }
}
.channel-form{
  &.el-form{
    .el-form-item__label{
      word-break: break-word;
    }
  }
}


.query-select{
  margin-right: 20px;
}

</style>

